<?php

namespace app\index\controller;

use AlipayHelper;
use app\common\Model\Coupons;
use controller\BasicApi;


/**
 * 应用入口控制器
 * @author Vilson
 */
class IndexController extends BasicApi{

    protected $siteName = 'biaokanjia';

    public
    function index(){
        $this->success('success 飚砍价阿里系接口入口');
    }

    public
    function get_alipay_user_info(){
        $aut_code = input('auth_code','');
        if(empty($aut_code)){
            $this->return_json(4001,'缺少参数：auth_code.');
        }
        require_once 'extend/alipay-sdk/helper/AlipayHelper.php';
        $ret = AlipayHelper::get_auth_token($aut_code);
        $this->return_json($ret);
    }


    public
    function alipay_refresh_token(){
        $aut_code = input('auth_code','');
        if(empty($aut_code)){
            $this->return_json(4001,'缺少参数：auth_code.');
        }
        require_once 'extend/alipay-sdk/helper/AlipayHelper.php';
        $ret = AlipayHelper::get_auth_token($aut_code);
        $this->return_json($ret);
    }


}
